<template>
   <div>
    <el-form-item label="提示文字">
      <el-input size="default" v-model="modelValue.placeholder" placeholder="请设置提示语"/>
    </el-form-item>
    <el-form-item label="选择流程">
      <el-cascader :show-all-levels="false" :props="{ emitPath: false }" v-model="modelValue.processCode" :options="options"></el-cascader>
    </el-form-item>
  </div>
</template>

<script>
import { onMounted, reactive, toRefs } from 'vue'
export default {
    name: 'ProcessIndexConfig',
    props: {
        modelValue: {
            type: Object,
            default: () => {
                return {}
            },
        },
    },
    emits: ['update:modelValue'],
    setup() {
        const state = reactive({
            options: []
        })
        const getModels = () => {
            state.options.length = 0
            // TO DO 接口
            return 
            getGroupModels().then((res) => {
                res.data.forEach((group) => {
                    state.options.push({
                        value: group.id,
                        label: group.name,
                        children: group.items.map((it) => {
                            return {
                                value: it.formId,
                                label: it.formName,
                            }
                        }),
                    })
                })
            }).catch((err) => {
                console.log(err)
            })
        }
        onMounted(() => {
            getModels()
        })
        return {
            ...toRefs(state)
        }
    }
}
</script>

<style>

</style>